const studentDao = require("../../models/student/studentModel")

module.exports={
    //显示所有的学生
    async getAllStudents(){
      return await studentDao.find().exec(); 
    },
    //添加学生
    async insertStudent({name,age,gender,address,score}){
      return await studentDao.create({name,age,gender,address,score});
    },
    //删除学生
    async deleStudentById(studentId){
      return await studentDao.deleteOne({"_id":studentId}).exec();
    },
    //根据id查询学生
    async getStudentById(studentId){
      return await studentDao.findById(studentId).exec();
    },
    //修改学生信息
    async updatStudentById({_id,name,age,address,score,gender}){
      return await studentDao.updateOne({_id},{name,age,address,score,gender}).exec();
    }



}